package com.lemon.smartsafetynew.ui.activity.record;

import android.os.Bundle;

import com.lemon.smartsafety.R;
import com.lemon.smartsafety.app.AppManager;
import com.lemon.smartsafetynew.ui.activity.base.SwipeBackActivity;
import com.lemon.smartsafetynew.entity.record.GridInfoDo;
import com.lemon.smartsafetynew.ui.fragment.record.CompanyListFragment;
import com.lemon.smartsafetynew.util.constants.KeyConstants;

/**
 * 一企一档--->搜网格--->企业列表
 * Created by Andrew on 2018/1/10.
 */

public class RecordCompanyListActivity extends SwipeBackActivity {

    private CompanyListFragment companyListFragment;
    private GridInfoDo data;

    @Override
    protected void getBundleArgs() {
        super.getBundleArgs();

        Bundle bundle = getIntent().getExtras();
        if(bundle != null) {
            if(bundle.containsKey(KeyConstants.KEY_GRID_DO)) {
                data = (GridInfoDo)bundle.getSerializable(KeyConstants.KEY_GRID_DO);
            }
        }
    }

    @Override
    protected void initTitle() {
        this.setBarTitle(getString(R.string.organization_list));
    }

    @Override
    protected void callFinish() {
        AppManager.getAppManager().finishActivity(RecordCompanyListActivity.this);
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_fragment;
    }

    @Override
    protected void initViews() {
        super.initViews();
        initFragment();

    }

    private void initFragment() {
        companyListFragment = CompanyListFragment.newInstance(data);
        getSupportFragmentManager().beginTransaction().replace(R.id.frameLayout, companyListFragment).commit();
    }


}
